unit ComputerEditUnit;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls,
  ADODB, DB;

type
  TfrmComputerEdit = class(TForm)
    GroupBox1: TGroupBox;
    Label1: TLabel;
    edtComputerName: TEdit;
    Label2: TLabel;
    edtIp: TEdit;
    Label3: TLabel;
    edtMask: TEdit;
    Label4: TLabel;
    edtMac: TEdit;
    Label5: TLabel;
    edtDNS1: TEdit;
    Label6: TLabel;
    edtDNS2: TEdit;
    Label7: TLabel;
    edtGateway: TEdit;
    btnOk: TButton;
    Label8: TLabel;
    cbbGroups: TComboBox;
    btnClose: TButton;
    Label9: TLabel;
    cbbDiskSize: TComboBox;
    procedure btnOkClick(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure btnCloseClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  frmComputerEdit: TfrmComputerEdit;

implementation

uses FunctionUnit, MainUnit, ConstUnit;

{$R *.dfm}

procedure TfrmComputerEdit.btnOkClick(Sender: TObject);
begin
  ModalResult := mrOk;
end;

procedure TfrmComputerEdit.FormCreate(Sender: TObject);
var
  Sql: string;
  Query: TADOQuery;
  i: Integer;
begin
  Sql := 'SELECT * FROM Groups';
  Query := TADOQuery.Create(Self);
  try
    OpenDataSet(Sql, Query, Database);
    while not Query.Eof do
    begin
      cbbGroups.Items.AddObject( Query.FieldByName('GroupName').AsString, TObject( Query.FieldByName('GroupId').AsInteger ) );
      Query.Next;
    end;
  finally
    Query.Free;
    Database.Close;
  end;

  for i := Low(DiskSizes) to High(DiskSizes) do
    cbbDiskSize.Items.Add( DiskSizes[i].DiskSizeName );

end;

procedure TfrmComputerEdit.btnCloseClick(Sender: TObject);
begin
  Close;
end;

end.
